home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / prog / arexx / scripti.lha / 3-DEE / Scripti / General / 24Bit->IFF.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1993-05-19  |  2.4 KB  |  130 lines

  1. /*
  2. ------------------------------------------------------------------------------
  3. This AREXX-Script will convert any 24Bit image to any number of colors,
  4.      specified by the user in the argument.
  5. The user decides to scale or not.
  6.  
  7. Host address: ADPro (Art Department Professional   ®ASDG)
  8. Written by Jan Van Overbeke, 3-DEE, ©1993.
  9. Read the AREXX-Scripti doc, for info about operation and rights!
  10. ------------------------------------------------------------------------------
  11. */
  12.  
  13. parse arg filename colors ditherc sx sy sc
  14. if ~exists(filename)|filename='' then do
  15.     say 'File not found!'
  16.     say 'See Ya.........'
  17.     say ''
  18.     exit
  19.     end
  20.  
  21. /* ---- Is the color argument right? ---- */
  22. /* -------------------------------------- */
  23. if ~(colors=256|colors='HAM8'|colors='HAM'|colors=2|colors=4|colors=8|colors=16|colors=32|colors=64|colors=128) then do
  24.     say "Unknown colors: wrong argument"
  25.     say 'See Ya.....'
  26.     say ''
  27.     exit
  28.     end
  29.  
  30. if ~(ditherc>-1|ditherc<7)then do
  31.     say 'Invalid dither-number!'
  32.     say 'See Ya.......'
  33.     say ''
  34.     exit
  35.     end
  36.  
  37. address 'ADPro'
  38. say 'Convert 24Bit To IFF: Written by Jan Van Overbeke, 3-DEE, ©1993.'
  39. say 'Image: 'filename
  40. say 'Colors: 'colors
  41. say 'Dithering Nmr: 'ditherc
  42. say 'Screen Code: 'sc
  43. say ''
  44.  
  45. lformat 'UNIVERSAL'
  46. if RC~=0 then do
  47.     say 'Unable to switch to Universal-loader'
  48.     say 'See Ya.......'
  49.     say ''
  50.     exit
  51.     end
  52.  
  53. sformat 'IFF'
  54. if RC~=0 then do
  55.     say 'Unable to switch to IFF-Saver'
  56.     say 'See Ya.......'
  57.     say ''
  58.     exit
  59.     end
  60.  
  61. say 'Loading.......'
  62. load filename
  63. if RC~=0 then do
  64.     say 'Load failed!!!!!!'
  65.     say 'See Ya......'
  66.     say ''
  67.     exit
  68.     end
  69.  
  70. /* ---- Adjusting palette to requested # colors. ---- */
  71. /* -------------------------------------------------- */
  72. say 'Converting.....'
  73. render_type colors
  74. palette=0
  75. if colors='HAM8' then palette=64
  76. if colors='HAM' then palette=16
  77. if palette=0 then palette=colors
  78. ptotal palette
  79. pused palette
  80.  
  81. dither ditherc
  82. if RC~=0 then do
  83.     say 'Had trouble switching Dither!'
  84.     say 'See Ya.....'
  85.     say ''
  86.     exit
  87.     end
  88.  
  89. screen_type sc
  90. if RC~=0 then do
  91.     say 'Unable to change screen!!!!'
  92.     say 'Wrong argument?'
  93.     say 'See Ya......'
  94.     say ''
  95.     exit
  96.     end
  97.  
  98. ABS_SCALE sx sy
  99. if RC~=0 then do
  100.     say 'Scale failed!!!!'
  101.     say 'See Ya.....'
  102.     say ''
  103.     exit
  104.     end
  105.  
  106. execute
  107. if RC~=0 then do
  108.     say 'Execute failed!!!!'
  109.     say 'See Ya......'
  110.     say ''
  111.     exit
  112.     end
  113.  
  114. say 'Saving......'
  115. save filename'.new' IMAGE
  116. if RC~=0 then do
  117.     say 'Save failed!!!!'
  118.     say 'See Ya....'
  119.     say ''
  120.     exit
  121.     end
  122.  
  123. dither 0
  124. if RC~=0 then do
  125.     say 'Unable to switch dither to 0!'
  126.     say 'See Ya.....'
  127.     end
  128. say ''
  129. exit
  130.